#include "COptionMenuState.h"
#include "CMainMenuState.h"
#include "CGame.h"
#include "SGD Wrappers/CSGD_Direct3D.h"
#include "SGD Wrappers/CSGD_TextureManager.h"
#include "SGD Wrappers/CSGD_DirectInput.h"

COptionMenuState::COptionMenuState()
{
	m_nCurrSelection = 0;
}
COptionMenuState::~COptionMenuState()
{

}
COptionMenuState* COptionMenuState::GetInstance()
{
	static COptionMenuState instance;
	return &instance;
}
void COptionMenuState::Enter()
{
	m_nMenuCursor = CSGD_TextureManager::GetInstance()->LoadTexture("resource/SGD_MenuCursor.png");
}
void COptionMenuState::Exit()
{
	CSGD_TextureManager::GetInstance()->UnloadTexture(m_nMenuCursor);
}
bool COptionMenuState::Input()
{
	if(CSGD_DirectInput::GetInstance()->KeyPressed(DIK_UP))
	{
		if(m_nCurrSelection == 0)
			m_nCurrSelection = 3;
		else
			m_nCurrSelection -= 1;
	}

	if(CSGD_DirectInput::GetInstance()->KeyPressed(DIK_DOWN))
	{
		if(m_nCurrSelection == 3)
			m_nCurrSelection = 0;
		else
			m_nCurrSelection += 1;
	}

	if(CSGD_DirectInput::GetInstance()->KeyPressed(DIK_RETURN))
	{
		if(m_nCurrSelection == 0)
		{

		}
		else if(m_nCurrSelection == 1)
		{

		}
		else if( m_nCurrSelection == 2)
		{

		}
		else if(m_nCurrSelection == 3)
		{
			CGame::GetInstance()->PopState();
		}
	}
	return true;
}
void COptionMenuState::Update(float fDelta)
{
	
}
void COptionMenuState::Render()
{
	CSGD_Direct3D::GetInstance()->DrawText("Options Menu", 100, 100);
	
	CSGD_TextureManager::GetInstance()->Draw(m_nMenuCursor, 80, (m_nCurrSelection*20) + 150);
	CSGD_Direct3D::GetInstance()->DrawText("Video", 100, 150);
	CSGD_Direct3D::GetInstance()->DrawText("Audio", 100, 170);
	CSGD_Direct3D::GetInstance()->DrawText("Controls", 100, 190);
	CSGD_Direct3D::GetInstance()->DrawText("Back to Main Menu", 100, 210);
}